<%--
  Created by IntelliJ IDEA.
  User: 86181
  Date: 2022/11/15
  Time: 19:23
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>出库详情模态框</title>
</head>
<body>
            <div class="modal-header">
                <button class="close" data-dismiss="modal">退出</button>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-md-offset-4"><h2><strong>出库申请单</strong></h2></div>
                </div>
                <br>
                <div class="row">
                    <div class="col-md-6">
                        <table>
                            <tr>
                                <td>申请单编号:</td>
                                <td><input type="text" id="payIdqueryshow" readonly style="border:none;outline: none"></td>
                            </tr>
                            <tr>
                                <td>出库人:</td>
                                <td><input type="text" id="storerqueryshow" readonly style="border:none;outline: none"></td>
                            </tr>
                        </table>
                    </div>
                    <div class="col-md-6">
                        <table>
                            <tr>
                                <td>出库理由:</td>
                                <td><input type="text" readonly id="reasonqueryshow" style="border:none;outline: none"></td>
                            </tr>
                        </table>
                    </div>
                </div>
                <br>
                <div style="height:45%">
                    <table id="querypayshowmodaltab">

                    </table>
                </div>
                <br>
                <div class="row">
                    <div class="col-md-6">
                        <table>
                            <tr>
                                <td>总数量:</td>
                                <td><input type="text" id="amountSumqueryshow" style="outline: none;border: none"></td>
                            </tr>
                            <tr>
                                <td>登记人:</td>
                                <td><input type="text" id="registerqueryshow" style="outline: none;border: none"></td>
                            </tr>
                            <tr>
                                <td>审核人:</td>
                                <td><input type="text" id="checkerqueryshow" style="outline: none;border: none"></td>
                            </tr>
                        </table>
                    </div>
                    <div class="col-md-6">
                        <table>
                            <tr>
                                <td>总金额:</td>
                                <td><input type="text" id="costPriceSumqueryshow" style="outline: none;border: none"></td>
                            </tr>
                            <tr>
                                <td>登记时间:</td>
                                <td><input type="text" id="registerTimequeryshow" style="outline: none;border: none"></td>
                            </tr>
                            <tr>
                                <td>审核时间:</td>
                                <td><input type="text" id="checkTimequeryshow" style="outline: none;border: none"></td>
                            </tr>
                        </table>
                    </div>
                </div>
                <br>
                <div class="form-group">
                    <label for="Issuerequisitiontextqueryshow"  class="control-label">配置要求:</label>
                    <textarea class="form-control" name="remark" id="Issuerequisitiontextqueryshow" style="width:800px;height:200px"></textarea>
                </div>
            </div>
            <script>
                //加载数据
                $(function () {
                    var payId='${param.payId}'

                    //给表格添加数据
                    $("#querypayshowmodaltab").bootstrapTable({
                        sortable: true,//是否显示排序
                        sortOrder: "aso",//排序方式
                        sidePagination:"server", //分页方式：client客户端分页，server服务端分页（*）
                        showColumns: true,//是否显示所有的列（选择显示的列）
                        showRefresh: true,//是否显示刷新按钮
                        minimumCountColumns: 2,//最少允许的列数
                        showToggle: true,//是否显示详细视图和列表视图的切换按钮
                        cardView: false,//是否显示详细视图
                        detailView: false,//是否显示父子表,
                        columns:[
                            {
                                field:"",
                                title:"序号",
                                formatter:function (value,row,index) {
                                    return Number(index)+1
                                }
                            },
                            {
                                field:"productName",
                                title:"产品名称",
                            },
                            {
                                field:"productId",
                                title:"产品编号",
                            },
                            {
                                field:"productDescribe",
                                title:"描述",
                            },
                            {
                                field:"amount",
                                title:"数量",
                            },
                            {
                                field:"amountUnit",
                                title:"单位",
                            },
                            {
                                field:"costPrice",
                                title:"成本价(元)",
                            },
                            {
                                field:"subtotal",
                                title:"小计(元)",
                            }
                        ]
                    })

                    $.post("queryByPayPayIdson.action",{"payId":payId},function (data) {
                        //出库编号
                        $("#payIdqueryshow").val(data.payId)
                        //出库人
                        $("#storerqueryshow").val(data.storer)
                        //出库理由
                        var reasons="";
                        if(data.reason=="C002-1"){
                            reasons="生产领料"
                        }
                        if(data.reason=="C002-2"){
                            reasons="赠送"
                        }
                        if(data.reason=="C002-3"){
                            reasons="内部借领"
                        }
                        if(data.reason==" C002-4"){
                            reasons="其他借领"
                        }
                        $("#reasonqueryshow").val(reasons)
                        //总数量
                        $("#amountSumqueryshow").val(data.amountSum)
                        //登记人
                        $("#registerqueryshow").val(data.register)
                        //审核人
                        $("#checkerqueryshow").val(data.checker)
                        //登记时间
                        $("#registerTimequeryshow").val(data.registerTime)
                        //总金额
                        $("#costPriceSumqueryshow").val(data.costPriceSum)
                        //审核时间
                        $("#checkTimequeryshow").val(data.checkTime)
                        //要求
                        $("#Issuerequisitiontextqueryshow").val(data.remark)
                        var arr=[];
                        var datas=data.payDetails;
                        for(var i=0;i<datas.length;i++){
                            arr.push(datas[i])
                        }
                        console.log(arr)
                        $("#querypayshowmodaltab").bootstrapTable("load",arr)
                    },"json")
                })
            </script>
</body>
</html>
